Todo

Background

Trimmer

Green board shape could not be collected. USNR software crashed whenever writing shape data to disk enabled.

Data collected USNR database on TRIMMER2.

SICK Camera

Power was lost briefly around 11:40a (someone tripped over the power cord?).

(see sick.Rmd)

Ecoustic

Ecoustic data collected as csv file copied from Ecoustic2 PC by ML.

Loaded into HYNE database using ecoustic-create.sql and ecoustic2db.py.

Ecoustic Dataset

library(lattice)
library(RODBC)
ch = odbcConnect('HYNE','sa','password12')
E = sqlQuery(ch, "select Timestamp, ScheduledDimensions, Width, Thickness, Length, Weight, Density, MOE from ecoustic")
E$swv = sqrt(E$MOE/E$Density*1e9)
E$f1 = E$swv/2/E$Length
#pairs(E[,3:10])
pairs(E[,7:9])

Board properties:

xyplot(Thickness ~ Timestamp, E)
xyplot(Width ~ Timestamp, E)
xyplot(Length ~ Timestamp, E)
xyplot(Density ~ Timestamp, E)
xyplot(MOE ~ Timestamp, E)
#summary(lm(MOE ~ ScaledMOE, E)) # MOE = ScaledMOE

What does Length=Thickness=Width=0 denote? All have Grade=‘Not graded’.

Where does the board dimension data come from? The Trimmer2 scanner? Yes, via PLC (not db).

sum(E$Length==0) # 18 length=width=thickness=0
## [1] 18
sum(E$Density<=0) # 0
## [1] NA
sum(E$Weight<=0) # 0
## [1] 0
sum(E$MOE==0) # 122
## [1] 122
E$MOE[E$Length==0] # always 0
##  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
E$MOE[E$Width==0] # always 0
##  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
E[E$MOE==6.50,] # nothing unusual
##                Timestamp ScheduledDimensions Width Thickness Length Weight
## 45   2014-08-31 10:04:50         100x38x7000  98.1      41.3   2425   5.23
## 47   2014-08-31 10:04:56          75x38x7000  76.8      42.1   2425   3.89
## 119  2014-08-31 10:32:03         100x38x7000  98.7      40.8   4850   9.34
## 120  2014-08-31 10:32:04         100x38x7000  98.6      41.0   4850   9.19
## 152  2014-08-31 10:40:48         100x38x7000  97.8      40.7   3637   4.66
## 181  2014-08-31 10:41:54         100x38x7000  98.5      40.7   4850   6.05
## 265  2014-08-31 10:44:50         100x38x7000  98.5      40.7   4850   6.12
## 305  2014-08-31 10:47:09         100x38x7000  98.3      41.2   4850  10.34
## 307  2014-08-31 10:47:11         100x38x7000  97.6      40.7   4850   8.86
## 320  2014-08-31 10:57:46         100x38x7000  97.1      40.7   4243  17.19
## 325  2014-08-31 10:57:50         100x38x7000  98.1      41.4   4850  11.86
## 365  2014-08-31 10:59:15         100x38x7000  98.7      40.7   4921   6.32
## 390  2014-08-31 11:00:13         100x38x7000  97.7      41.0   4850   8.32
## 405  2014-08-31 11:00:23         100x38x7000  98.3      40.7   4850   8.12
## 531  2014-08-31 11:04:00         100x38x7000 101.1      41.3   4243  12.56
## 547  2014-08-31 11:05:32         100x38x7000  98.3      40.8   4850   6.14
## 579  2014-08-31 11:06:04         100x38x7000  99.3      40.8   4850   7.00
## 622  2014-08-31 11:07:03         100x38x7000  98.5      40.7   4850   7.25
## 695  2014-08-31 11:22:01          75x38x7000  77.6      41.8   4850   4.75
## 716  2014-08-31 11:22:31         100x38x7000  97.3      41.0   3027   8.34
## 734  2014-08-31 11:22:52         100x38x7000  98.3      40.4   4850   7.75
## 909  2014-08-31 11:26:05         100x38x7000  98.5      40.7   4850   8.18
## 921  2014-08-31 11:26:13         100x38x7000  97.5      40.7   4850   7.69
## 927  2014-08-31 11:26:17         100x38x7000  97.4      40.5   4850   5.74
## 977  2014-08-31 11:26:53         100x38x7000  98.4      40.7   4850   9.60
## 985  2014-08-31 11:27:00         100x38x7000  98.2      40.3   4850   6.01
## 993  2014-08-31 11:27:11         100x38x7000  98.0      40.4   4850   6.68
## 1012 2014-08-31 11:27:28         100x38x7000  97.4      40.8   4850   7.18
## 1017 2014-08-31 11:27:34         100x38x7000  97.4      40.4   4850   7.23
## 1019 2014-08-31 11:27:36         100x38x7000  97.6      41.2   4850   6.74
## 1020 2014-08-31 11:27:36         100x38x7000  97.9      40.8   4850   6.95
## 1047 2014-08-31 11:28:00          75x38x7000  77.2      40.8   4850   5.21
## 1070 2014-08-31 11:28:14         100x38x7000  98.5      40.7   4850   6.18
## 1136 2014-08-31 11:29:44         100x38x7000  97.8      42.1   4850  13.01
## 1154 2014-08-31 11:30:16         100x38x7000  97.7      40.6   4850   5.76
## 1158 2014-08-31 11:30:19         100x38x7000  98.5      40.7   4860   7.23
## 1199 2014-08-31 11:30:46         100x38x7000  98.3      40.7   4850   7.01
## 1203 2014-08-31 11:30:49         100x38x7000  98.9      40.7   4850   7.04
## 1218 2014-08-31 11:31:35          75x38x7000  76.1      41.6   4850   5.92
## 1346 2014-08-31 11:35:48         100x38x7000  98.3      40.7   4850   6.04
## 1391 2014-08-31 11:37:44         100x38x7000  98.3      40.7   4850   5.29
## 1439 2014-08-31 11:38:30         100x38x7000  98.3      40.8   4850   5.32
## 1446 2014-08-31 11:38:34         100x38x7000  98.8      40.8   4850   5.29
## 1462 2014-08-31 11:38:58         100x38x7000  98.0      40.8   4850   4.69
## 1475 2014-08-31 11:39:09         100x38x7000  98.1      40.7   4850   5.36
## 1537 2014-08-31 11:41:27         100x38x7000  98.3      40.8   4850   5.33
## 1568 2014-08-31 11:41:48         100x38x7000  98.3      40.8   4850   6.83
## 1609 2014-08-31 11:42:17          75x38x7000  76.3      40.5   2435  11.10
## 1612 2014-08-31 11:42:21         100x38x7000  97.2      41.1   4834   7.36
## 1624 2014-08-31 11:42:34         100x38x7000  98.3      40.6   4850   5.15
## 1626 2014-08-31 11:42:35         100x38x7000  97.9      40.3   4850   7.28
## 1627 2014-08-31 11:42:39         100x38x7000  98.4      40.8   4850   5.66
## 1657 2014-08-31 11:43:28         100x38x7000  98.3      40.7   4850   6.06
## 1708 2014-08-31 11:44:31         100x38x7000  98.4      40.8   4850   5.57
## 1720 2014-08-31 11:44:45         100x38x7000  97.2      41.6   4850   7.75
## 1721 2014-08-31 11:44:46          75x38x7000  77.1      41.5   4850   4.64
## 1771 2014-08-31 11:45:47         100x38x7000  98.4      40.7   4850   5.89
## 1797 2014-08-31 11:46:13         100x38x7000  98.4      40.8   4850   5.17
## 1824 2014-08-31 11:46:53         100x38x7000  98.6      40.8   4850   5.68
## 1872 2014-08-31 11:48:13         100x38x7000  98.5      40.6   4850   5.11
## 1901 2014-08-31 11:48:43         100x38x7000  98.1      40.6   4850  10.74
## 1903 2014-08-31 11:48:44         100x38x7000  98.4      40.8   4850   4.92
## 1985 2014-08-31 11:56:50         100x38x7000  98.4      40.8   4850   6.68
##      Density MOE      swv        f1
## 45    532.14 6.5 3494.972 0.7206128
## 47    496.55 6.5 3618.055 0.7459908
## 119   478.00 6.5 3687.591 0.3801640
## 120   468.88 6.5 3723.281 0.3838434
## 152   321.78 6.5 4494.456 0.6178796
## 181   311.09 6.5 4571.026 0.4712398
## 265   315.00 6.5 4542.568 0.4683059
## 305   526.33 6.5 3514.209 0.3622896
## 307   459.88 6.5 3759.537 0.3875812
## 320  1025.09 6.5 2518.116 0.2967376
## 325   602.00 6.5 3285.931 0.3387558
## 365   319.65 6.5 4509.406 0.4581798
## 390   428.23 6.5 3895.993 0.4016487
## 405   418.54 6.5 3940.834 0.4062716
## 531   708.90 6.5 3028.058 0.3568298
## 547   315.85 6.5 4536.451 0.4676754
## 579   356.02 6.5 4272.868 0.4405019
## 622   373.03 6.5 4174.311 0.4303413
## 695   301.71 6.5 4641.537 0.4785090
## 716   690.74 6.5 3067.605 0.5067071
## 734   402.21 6.5 4020.039 0.4144370
## 909   420.98 6.5 3929.397 0.4050925
## 921   399.28 6.5 4034.762 0.4159548
## 927   300.05 6.5 4654.359 0.4798308
## 977   494.39 6.5 3625.950 0.3738093
## 985   313.42 6.5 4554.003 0.4694849
## 993   348.01 6.5 4321.762 0.4455424
## 1012  372.69 6.5 4176.215 0.4305376
## 1017  378.87 6.5 4142.014 0.4270118
## 1019  345.63 6.5 4336.616 0.4470738
## 1020  358.78 6.5 4256.401 0.4388043
## 1047  341.18 6.5 4364.806 0.4499799
## 1070  317.91 6.5 4521.730 0.4661577
## 1136  651.67 6.5 3158.223 0.3255900
## 1154  299.61 6.5 4657.775 0.4801830
## 1158  371.10 6.5 4185.152 0.4305712
## 1199  361.46 6.5 4240.593 0.4371745
## 1203  360.42 6.5 4246.706 0.4378048
## 1218  385.46 6.5 4106.455 0.4233458
## 1346  311.25 6.5 4569.851 0.4711186
## 1391  272.56 6.5 4883.437 0.5034471
## 1439  273.60 6.5 4874.147 0.5024894
## 1446  270.41 6.5 4902.813 0.5054446
## 1462  241.64 6.5 5186.475 0.5346881
## 1475  276.84 6.5 4845.541 0.4995403
## 1537  274.08 6.5 4869.877 0.5020492
## 1568  351.04 6.5 4303.070 0.4436154
## 1609 1475.49 6.5 2098.885 0.4309824
## 1612  380.97 6.5 4130.582 0.4272427
## 1624  266.11 6.5 4942.266 0.5095119
## 1626  380.35 6.5 4133.948 0.4261802
## 1627  290.48 6.5 4730.408 0.4876709
## 1657  312.19 6.5 4562.965 0.4704088
## 1708  286.05 6.5 4766.896 0.4914326
## 1720  395.31 6.5 4054.971 0.4180383
## 1721  299.23 6.5 4660.732 0.4804878
## 1771  303.42 6.5 4628.439 0.4771587
## 1797  265.44 6.5 4948.499 0.5101545
## 1824  291.34 6.5 4723.421 0.4869506
## 1872  263.63 6.5 4965.457 0.5119028
## 1901  555.77 6.5 3419.866 0.3525635
## 1903  252.77 6.5 5071.004 0.5227839
## 1985  343.04 6.5 4352.956 0.4487584
histogram(~Thickness | ScheduledDimensions, E, nint=1000, type='count')
histogram(~Width | ScheduledDimensions, E, nint=1000, type='count')
histogram(~Length | ScheduledDimensions, E, nint=1000, type='count')
histogram(~Weight | ScheduledDimensions, E, nint=100)
histogram(~Density | ScheduledDimensions, E, nint=100)
histogram(~MOE | ScheduledDimensions, E, nint=10001)

~6% of boards have densities>1100 kg/m^3, these are considered unreasonable (a fully saturated board of basic density 500 kg/m^3 has a green density of 1166 kg/m^3).

Why does MOE=6.50 occur way more often than it should?

On the question below there are some cases where 6.5 MoE is assumed. It happens when the confidence in the velocity is low (~50%) but the mill wanted a conservative approach (don’t throw potentially good boards out) so 6.5 is assigned. The real MoE could be above or below that. One reason the confidence could be low on trimmer line 2 is that there can be some bouncing of the test boards away from the hammer when the next large board hits the fence after the trimmer. There is no record in the file of which boards had low confidence.

Total Recovery

Total flitches seen in trial period (based on TRIMMER2_FlitchDetail table): 1959 (10:29:39–11:56:15 T2.DateTime)

Non trial flitches imaged: 5 (SICK_images.id in 28,33,43,64,102).

Total trial flitches: 1954+1=1955 (extra is due to flitchId=1281565 containing two boards!)

Note that SICK_images.id=43 is FlitchID=1281070 and has no corresponding board!! As do a total of 68 in trial flitches.

Total images containing boards in the SICK_images table: 1886

Total number of boards imaged with SICK camera: 1887. One image contains two boards (sid=1187, 20140831_110531667_GOOD_READ, flitchId=1281565)

Flitches not seen by SICK due to power outage: 73 (11:39:16–11:40:26 T2.DateTime, 11:39–11:40:11 SICK_images.Timestamp)

Total readable images in SICK_barcodes table: 1793 (92% of trial flitches)

Total boards in ecoustic: 1790

Byproduct boards (no ecoustic): 101

Trial boards with no labels: 8

Trial boards with unreadable labels:

library(RODBC)
ch = odbcConnect('HYNE','sa','password12')
L = sqlQuery(ch, "
select logs.*, t.*, (L.h + S.h)/2. as heartVolFrac from
logs
left join (select t.SWILogNumber, power(heartwoodDiameter_mm,2)/POWER(LED,2) as h from logends as e left join yardTrimmed as t on t.SWILogNumber=e.SWILogNumber where logEnd='L') as L
on L.SWILogNumber=logs.SWILogNumber
left join (select t.SWILogNumber, power(heartwoodDiameter_mm,2)/POWER(SED,2) as h from logends as e left join yardTrimmed as t on t.SWILogNumber=e.SWILogNumber where logEnd='S') as S
on S.SWILogNumber=logs.SWILogNumber
left join yardTrimmed as t
on t.SWILogNumber=logs.SWILogNumber
where logs.SWILogNumber is not null and logs.DateAndTime>'2014-08-31 09:00:00'
order by logs.DateAndTime             
")
B.all = sqlQuery(ch, '
select 
f.flitchId, f.DateTime as [t.trimmer2], f.SWILogNumber,
                 f.Width as Wf, f.Thickness as Tf, f.Length as Lf,
b.boardId, b.isByproduct, 
                 b.Width as Wb, b.Thickness as Tb, b.Length as Lb,
s.id as sickImageId, s.Timestamp as [t.SICK], s.nboards, s.filename, 
                 s.boardWidth_pxl*0.137 as Ws, s.boardThickness_pxl*0.137 as Ts,
                 s.boardOrientation_rad as theta_s,
e.id as ecousticId, e.Timestamp as [t.ecoustic], e.Width, f.Thickness, f.Length,
                 e.Width as We, e.Thickness as Te, e.Length as Le, e.Weight, e.Density, e.MOE
from TRIMMER2_FlitchDetail as f full join TRIMMER2_BoardDetail as b 
on b.flitchId=f.flitchid 
left join SICK_images as s
on s.flitchId=f.flitchId
full join ecoustic as e
on e.flitchId2=f.flitchId
where inTrial in (0,1)
order by f.DateTime')
B.all$W = B.all$Wf
B.all$T = B.all$Tf
B.all$L = B.all$Lf
#is100x450 = B.all$Wb>95 & B.all$Tb>36
is100x40 = B.all$Wf>95 & B.all$Tf>35 # 1443 boards
ii = !is100x40 & !is.na(B.all$Le) & B.all$isByproduct!=1 # use ecoustic length except when isByproduct=1
B.all$L[ii] = B.all$Le[ii]
ii = !is100x40 & !is.na(B.all$Lb) & B.all$isByproduct==1 # in which case use Lb
B.all$L[ii] = B.all$Lb[ii]
B.all$V = B.all$W*B.all$T*B.all$L/1e9
B.all$swv = sqrt(B.all$MOE/B.all$Density*1e9)

# total volume recovered as boards
sum(B.all$V)/sum(L$volume) # 67%
## [1] 0.6721218
# number of boards with known LogNumber
B.knownlog = B.all[!is.na(B.all$SWILogNumber),]
nrow(B.knownlog) # 1754 (90%)
## [1] 1954
# number of boards with known LogNumber and reasonable MOE and Density (remember MOE=6.50 is a default value)
B = B.all[!is.na(B.all$SWILogNumber) & 
            !is.na(B.all$MOE) & B.all$MOE>0 & B.all$MOE!=6.50 &
            !is.na(B.all$Density) & B.all$Density<1100 & 
            B.all$swv<4000,]
## Warning: closing unused RODBC handle 1
B$SWILogNumber = factor(substr(B$SWILogNumber,1,3), ordered=TRUE)
nrow(B) # 1486 (76%)
## [1] 1486
# number of 100x40's
sum(is100x40) # 1443 (74%)
## [1] 1443
# various sets of dodgy logs
marco.drop = c(101, 102, 106, 115, 116, 118, 121, 123, 129, 130, 132, 134, 136, 142, 143, 151, 153, 157, 161, 168, 171, 172, 175, 178, 181, 183, 184, 191, 201)
marco.small.maybe.drop = c(110, 117, 159, 176, 179, 196)
sick.off = c(161, 110, 159, 101, 184, 178, 120, 122, 116, 118, 106, 102, 175, 121, 183, 129)
bad.saw.pattern = c()

Finished board dimensions are f.Width, f.Thickness and if 100x40 f.Length, otherwise b.Length (unless b missing…)

Board Dimensions

Let’s compare the dimension data in the trimmer (f=FlitchDetail, b=BoardDetail), SICK (s=skimage.regionprops), ecoustic (e)YY

pairs(B[,c('Wf','Wb','We','Ws')])
pairs(B[,c('Tf','Tb','Te','Ts')])
pairs(B[,c('Lf','Lb','Le')])
imismatch = abs(B$Wf-B$We)>10 | abs(B$Tf-B$Te)>10 | abs(B$Lb-B$Le)>200
B[imismatch,c('flitchId','isByproduct','Wf','Wb','Ws','We','Tf','Tb','Ts','Te','Lf','Lb','Le')]
##      flitchId isByproduct   Wf Wb        Ws   We   Tf Tb       Ts   Te
## 248   1281309           1 97.5 75  85.22223 98.4 41.3 38 38.03878 40.7
## 358   1281419           1 99.9 75  97.13408 97.6 41.3 38 37.40770 41.4
## 365   1281426           1 97.3 75  98.30507 97.1 28.0 25 27.00420 40.6
## 500   1281561           1 97.0 75  97.03825 76.6 42.7 38 39.17180 40.6
## 516   1281577           1 97.3 75  99.20158 79.6 40.7 38 38.08673 40.4
## 675   1281736           1 97.3 75  98.52973 97.0 42.4 38 43.27950 41.1
## 692   1281753           1 98.0 75  94.38307 97.8 41.6 38 38.11322 41.0
## 736   1281797           1 97.2 75 100.23004 97.2 41.2 38 44.60452 41.2
## 823   1281884           1 99.5 75  96.10237 76.7 41.3 38 40.43689 41.3
## 867   1281928           1 98.1 75  94.55882 97.2 41.8 38 41.80085 40.7
## 1074  1282135           1 98.0 75  94.37286 97.6 41.3 38 37.84145 40.5
## 1112  1282173           1 98.0 75  94.16214 98.4 42.0 38 36.56078 40.9
## 1194  1282255           1 77.3 75  72.17913 97.2 40.9 25 36.52155 40.8
## 1389  1282450           1 77.3 75  72.59385 97.7 43.3 25 40.04053 40.9
## 1438  1282499           1 76.8 75  76.17832 96.7 41.6 25 38.70079 40.7
## 1487  1282548           1 76.5 75  75.66968 97.8 41.6 25 39.33069 40.7
## 1703  1282764           1 97.6 75  76.67522 97.0 42.3 38 37.16935 41.3
## 1782  1282843           1 97.7 75  97.36539 98.4 28.2 25 25.73726 40.7
## 1827  1282888           1 97.7 75  97.16368 77.2 41.5 38 41.25912 40.9
## 1952  1283013           1 98.8 75  99.25655 76.9 42.6 38 39.66019 41.4
##        Lf   Lb   Le
## 248  4925 4200 4942
## 358  4947 4200 4850
## 365  4763 3600 4850
## 500  4906 4800 4850
## 516  4914 4800 4850
## 675  4910 3600 4850
## 692  4924 3600 4850
## 736  4931 4200 4850
## 823  4872 4800 4850
## 867  4914 4200 4850
## 1074 4911 4200 4850
## 1112 4920 3600 4850
## 1194 4928 4800 4850
## 1389 4905 4800 4850
## 1438 4905 3600 4850
## 1487 4935 4800 4850
## 1703 4916 4200 4850
## 1782 4933 4800 4850
## 1827 4891 3600 4850
## 1952 4948 4800 4242

The 19 boards (5 of them 100x40s) with significantly different dimensions in the FlitchDetail and Ecoustic tables are all byproducts that normally would have been tippled out and resawn. Instead they were passed through the trim saw and on to the ecoustic which, since it is triggered locally with a PE, tapped them. If the PLC dosn’t know about these boards then the ecoustic acquires the dimensions of the previous board from the PLC. In these cases, the FlitchDetail estimates of dimensions are more likely best, and Density and MOE should be recalculated (but using the BoardDetail length!). In fact, Density and MOE could be recalculated for all isByproduct=1 boards. To do this requires estimating volume from FlitchDetail nominal dimensions (rather than the 3D cloud that the USNR software would have used) and extracting resonant frequency from ecoustic MOE.

AAAARGGGH. Some 100x40’s that the optimiser thought should be re-edged were also trimmed (probably because the do-not-trim logic was based on optimised rather than actual board dimensions) e.g. FlitchId 1282173.

hist(B$L[is100x40],100)

Is log length distinct enough to help identify boards that no good barcode read was extracted from?

bwplot(as.factor(SWILogNumber) ~ Le, B, subset=is100x40)

Board Orientation in SICK Images

ii = !is.na(B$theta_s)
t = B$theta_s[ii]
t[t<0] = pi + t[t<0]
histogram(t/pi*180., breaks=seq(60,120))
summary(t*180/pi)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   72.06   90.40   91.31   91.41   92.23  112.30

Assign SWILogNumber to unidentified boards —————————————–’

Based on:

  1. sequence
  2. untrimmed (FlitchDetail) length
  3. time (but apart from limited cases where whole chain flushed no more info than sequence and a lot harder to work with)
  4. Saw pattern (see below) but this is pretty tricky

Not much than can be done about the boards 73 boards that passed through while the SICK camera was off (from logs: 161, 110, 159, 101, 184, 178, 120, 122, 116, 118, 106, 102, 175, 121, 183, 129)

plot(1:nrow(B.all), B.all$Lf, cex=0.1)#, xlim=c(0,30))
text(c(1:nrow(B.all)), B.all$Lf+40, B.all$SWILogNumber, cex=0.7)
# Do this using plot.ly (so zoom-pan-identify works easily):
library(plotly)
## Loading required package: RCurl
## Loading required package: bitops
## Loading required package: RJSONIO
## Loading required package: ggplot2
py <- plotly()
trace0 <- list(
  #x = B.all$t.trimmer2,
  x = 1:nrow(B.all),
  y = B.all$Lf,
  mode = "markers+text",
  text = B.all$SWILogNumber,
  textposition = "top",
  type = "scatter"
   )
layout <- list(
  #xaxis = list(range = c(1, 15)), 
  xaxis = list(range = c(1480, 1580)), 
  #yaxis = list(range = c(4600, 5000))
  yaxis = list(range = c(4850, 4980))
)
response <- py$plotly(trace0, kwargs=list(layout=layout, filename="hyne-untrimmed-board-length", fileopt="overwrite"))
response$url
## [1] "https://plot.ly/~letme1n/1"

Board Density, MOE and SWV

library(hexbin)
splom(B[,c('Density','MOE','swv')], lower.panel=function(x,y,...){panel.hexbinplot(x,y)})

Hmmm. What green board data have we got to compare this with?

library(plyr)
library(lattice)
L = merge(L, ddply(B, .(SWILogNumber), summarize, 
                   nboards=length(SWILogNumber), 
                   boardVolume=sum(V),
                   boardArea=sum(W*T),
                   avgBoardMOE = sum(MOE*W*T)/boardArea,
                   avgBoardDEN = sum(Density*W*T)/boardArea,
                   avgBoardSWV = sum(swv*W*T)/boardArea
                   ))
L$recFrac = L$boardVolume/L$volume
L$den = L$weight/L$volume
L$MOE = L$SWV^2*L$den / 1e9
xyplot(volume ~ nboards, L)
suspect.lognumbers= c(161, 110, 159, 101, 184, 178, 120, 122, 116, 118, 106, 102, 175, 121, 183, 129) # logs likely to have boards the SIC camera missed during outage
clr = rep('black',nrow(L))
clr[L$SWILogNumber %in% suspect.lognumbers] = 'red'
plot(boardVolume/volume*100 ~ volume, L, ylab='% Recovered Boards with Readable Labels', col=clr)
text(L$volume, L$boardVolume/L$volume*100+1.2, L$SWILogNumber, cex=0.6)

Why is log 137 the best recovered? All boards from 137 are actual reads from the SICK camera rather than maual assignations.

Average Board Density

plot(avgBoardDEN ~ den, L, xlab='Log Density / [kg/m^3]', ylab='Average Green Board Density / [kg/m^3]')
abline(c(0,1),col='grey70')
summary(m <- lm(avgBoardDEN ~ den + heartVolFrac, L)) 
## 
## Call:
## lm(formula = avgBoardDEN ~ den + heartVolFrac, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -160.374  -37.777   -4.736   40.981  159.981 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -201.4134   163.5470  -1.232    0.221    
## den             0.9823     0.1523   6.449 2.46e-09 ***
## heartVolFrac  -68.8044   107.1280  -0.642    0.522    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 60.13 on 120 degrees of freedom
## Multiple R-squared:  0.5956, Adjusted R-squared:  0.5889 
## F-statistic: 88.38 on 2 and 120 DF,  p-value: < 2.2e-16

Why is log density so much higher than average board density? Just due to over representation of inner material?

Average Board SWV

Only look at hitman SWV due to issues with calibre SWV (see hyne-log.Rmd).

plot(avgBoardSWV ~ SWV, L, xlab='Log Sonic Velocity / [m/s]', ylab='Average Green Board SWV / [m/s]')
abline(c(0,1),col='grey70')
summary(m <- lm(avgBoardSWV ~ SWV, L))
## 
## Call:
## lm(formula = avgBoardSWV ~ SWV, data = L)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -306.63  -74.07   12.99   75.57  249.26 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -392.26040  148.63533  -2.639  0.00942 ** 
## SWV            1.04378    0.04508  23.155  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 119.6 on 120 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.8171, Adjusted R-squared:  0.8156 
## F-statistic: 536.1 on 1 and 120 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardSWV ~ SWV + heartVolFrac, L))
## 
## Call:
## lm(formula = avgBoardSWV ~ SWV + heartVolFrac, data = L)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -304.71  -72.88   13.72   76.04  248.86 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -388.17938  151.84409  -2.556   0.0118 *  
## SWV             1.04133    0.04829  21.565   <2e-16 ***
## heartVolFrac   17.54688  120.27446   0.146   0.8843    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 120.1 on 119 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.8171, Adjusted R-squared:  0.8141 
## F-statistic: 265.9 on 2 and 119 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardSWV ~ SWV + heartVolFrac + den, L)) 
## 
## Call:
## lm(formula = avgBoardSWV ~ SWV + heartVolFrac + den, data = L)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -274.00  -72.95   14.52   70.65  242.59 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   387.82163  345.06958   1.124   0.2633    
## SWV             1.04876    0.04736  22.145   <2e-16 ***
## heartVolFrac -435.70662  216.67045  -2.011   0.0466 *  
## den            -0.74647    0.29957  -2.492   0.0141 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 117.6 on 118 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.8263, Adjusted R-squared:  0.8219 
## F-statistic: 187.1 on 3 and 118 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardSWV ~ SWV + heartVolFrac + avgBoardDEN, L)) 
## 
## Call:
## lm(formula = avgBoardSWV ~ SWV + heartVolFrac + avgBoardDEN, 
##     data = L)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -308.86  -71.48   12.03   77.90  216.47 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   350.29967  225.38719   1.554   0.1228    
## SWV             0.98172    0.04735  20.732  < 2e-16 ***
## heartVolFrac -359.06919  143.64033  -2.500   0.0138 *  
## avgBoardDEN    -0.65188    0.15441  -4.222 4.79e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 112.4 on 118 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.8411, Adjusted R-squared:  0.8371 
## F-statistic: 208.3 on 3 and 118 DF,  p-value: < 2.2e-16

Average Board MOE

xyplot(avgBoardMOE ~ SWV, L, xlab='Log Sonic Velocity / [m/s]', ylab='Average Green Board MOE / [GPa]')
xyplot(avgBoardMOE ~ MOE, L, xlab='Log MOE / [GPa]', ylab='Average Green Board MOE / [GPa]')
summary(m <- lm(avgBoardMOE ~ MOE, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ MOE, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.76947 -0.42905 -0.02078  0.44396  1.55460 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.17282    0.42926   0.403    0.688    
## MOE          0.61299    0.04193  14.618   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6838 on 120 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6404, Adjusted R-squared:  0.6374 
## F-statistic: 213.7 on 1 and 120 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ SWV, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ SWV, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.54062 -0.60211  0.02656  0.60749  1.99237 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.0188520  1.1257598  -2.682  0.00836 ** 
## SWV          0.0028588  0.0003414   8.373 1.21e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.906 on 120 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.3688, Adjusted R-squared:  0.3635 
## F-statistic: 70.11 on 1 and 120 DF,  p-value: 1.211e-13
summary(m <- lm(avgBoardMOE ~ MOE + den, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ MOE + den, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.67513 -0.38362  0.01993  0.39976  1.59725 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.0208268  0.8556733  -2.362  0.01982 *  
## MOE          0.5820680  0.0420087  13.856  < 2e-16 ***
## den          0.0026832  0.0009144   2.934  0.00401 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6631 on 119 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6646, Adjusted R-squared:  0.659 
## F-statistic: 117.9 on 2 and 119 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ SWV + den, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ SWV + den, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.71016 -0.42687  0.02635  0.44095  1.60672 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1.388e+01  1.388e+00  -10.00   <2e-16 ***
## SWV          3.548e-03  2.642e-04   13.43   <2e-16 ***
## den          9.198e-03  9.357e-04    9.83   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6758 on 119 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6516, Adjusted R-squared:  0.6458 
## F-statistic: 111.3 on 2 and 119 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ MOE + heartVolFrac, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ MOE + heartVolFrac, data = L)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.6921 -0.4324 -0.0388  0.4639  1.5095 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   0.69008    0.45383   1.521  0.13102    
## MOE           0.60237    0.04088  14.734  < 2e-16 ***
## heartVolFrac -1.80243    0.62579  -2.880  0.00471 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6639 on 119 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6638, Adjusted R-squared:  0.6582 
## F-statistic: 117.5 on 2 and 119 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ SWV + heartVolFrac, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ SWV + heartVolFrac, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.73952 -0.46534 -0.09091  0.61570  1.56269 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -4.3726163  0.9322522  -4.690 7.34e-06 ***
## SWV           0.0036727  0.0002965  12.388  < 2e-16 ***
## heartVolFrac -5.8206963  0.7384294  -7.883 1.71e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7374 on 119 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.5853, Adjusted R-squared:  0.5783 
## F-statistic: 83.98 on 2 and 119 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ MOE + heartVolFrac + den, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ MOE + heartVolFrac + den, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.67622 -0.39895  0.00185  0.45486  1.55828 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.882597   1.824861  -0.484    0.630    
## MOE           0.589509   0.043395  13.585   <2e-16 ***
## heartVolFrac -0.865620   1.225048  -0.707    0.481    
## den           0.001595   0.001792   0.890    0.375    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6645 on 118 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.666,  Adjusted R-squared:  0.6576 
## F-statistic: 78.45 on 3 and 118 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ SWV + heartVolFrac + den, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ SWV + heartVolFrac + den, data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.69782 -0.42456  0.01376  0.48863  1.57085 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1.297e+01  1.989e+00  -6.523 1.80e-09 ***
## SWV           3.590e-03  2.729e-04  13.155  < 2e-16 ***
## heartVolFrac -7.978e-01  1.249e+00  -0.639    0.524    
## den           8.272e-03  1.726e-03   4.791 4.86e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6775 on 118 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6528, Adjusted R-squared:  0.644 
## F-statistic: 73.97 on 3 and 118 DF,  p-value: < 2.2e-16
summary(m <- lm(avgBoardMOE ~ SWV + heartVolFrac + den + avgBoardDEN, L))
## 
## Call:
## lm(formula = avgBoardMOE ~ SWV + heartVolFrac + den + avgBoardDEN, 
##     data = L)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.33707 -0.35998  0.04685  0.41238  1.09554 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1.352e+01  1.573e+00  -8.596 4.27e-14 ***
## SWV           4.349e-03  2.335e-04  18.629  < 2e-16 ***
## heartVolFrac -1.106e+00  9.873e-01  -1.120    0.265    
## den           6.598e-04  1.633e-03   0.404    0.687    
## avgBoardDEN   7.468e-03  8.800e-04   8.486 7.67e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.5353 on 117 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.7851, Adjusted R-squared:  0.7778 
## F-statistic: 106.9 on 4 and 117 DF,  p-value: < 2.2e-16

Estimates of heartwood volume fraction and log green density add significantly to prediction of average green board stiffness from log SWV.

Saw Patterns

Plot board centroids:

library(RODBC)
ch = odbcConnect('HYNE','sa','password12')
C = sqlQuery(ch, "select *, 
             (i1-42)*0.7071*20.0 - (i2-42)*0.2588*20.0 as x,
(i1-42)*0.7071*20.0 + (i2-42)*0.9659*20.0 as y
             from SICK_barcodes")# where boardCentroidX_mm is not null")
C$xc = C$boardCentroidX_mm
C$yc = C$boardCentroidY_mm

#xyplot(y ~ x | as.factor(SWILogNumber), C, group=imageId, aspect='iso', pch=19, subset=imageId==721)
#xyplot(yc ~ xc | as.factor(SWILogNumber), C, group=imageId, aspect='iso', pch=19, subset=imageId==721)

#xyplot(y ~ x | as.factor(SWILogNumber), C, group=imageId, aspect='iso', pch=19, type='b')#, subset=SWILogNumber==150)

#xyplot(yc ~ xc | as.factor(SWILogNumber), C, group=imageId, aspect='iso', pch=19, type='b')#, subset=SWILogNumber==150)

library(latticeExtra)
## Loading required package: RColorBrewer
## 
## Attaching package: 'latticeExtra'
## 
## The following object is masked from 'package:ggplot2':
## 
##     layer
D = sqlQuery(ch, "select flipbookNumber, e.digitizationID, type, x_mm as x, y_mm as y from LogEndDigitizations as d, LogEndDigitizationEdges as e, LogEndDigitizationPoints as p 
             where p.edgeId=e.id and e.digitizationId=d.id and type='underbark' and logEnd='large'")
D$xrot =  cos(1*pi/4)*D$x + sin(1*pi/4)*D$y
D$yrot = -sin(1*pi/4)*D$x + cos(1*pi/4)*D$y

xyplot(yc ~ xc | as.factor(SWILogNumber), C, group=imageId, aspect='iso', pch=19, type='b', xlim=c(-1,1)*400, ylim=c(-1,1)*400) + as.layer(xyplot(y ~ x | as.factor(flipbookNumber), D, type='l', group=paste(digitizationID, type), aspect='iso', col='grey70')) + as.layer(xyplot(yrot ~ xrot | as.factor(flipbookNumber), D, type='l', group=paste(digitizationID, type), aspect='iso', col='grey30'))
## Warning: closing unused RODBC handle 2

SICK camera scale factor

histogram(~pxl2mm, nint=30, C)
summary(C$pxl2mm)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##  0.1422  0.1553  0.1568  0.1569  0.1582  0.1834     520

Does SICK scale factor vary through time?

library(RODBC)
ch = odbcConnect('HYNE','sa','password12')
F = sqlQuery(ch, "select b.pxl2mm, i.Timestamp from SICK_images as i left join SICK_barcodes as b on b.imageId=i.id where nboards>0")
xyplot(pxl2mm ~ Timestamp, F)
library(changepoint)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Successfully loaded changepoint package version 1.1.5
## Created on 2014-06-25
##  Substantial changes to the structure of the package have occured from version 1.0.  Please see the package NEWS for details.
summary(m <- cpt.mean(F$pxl2mm[is.finite(F$pxl2mm)],method='PELT'))
## Changepoint type      : Change in mean 
## Method of analysis    : PELT 
## Test Statistic  : Normal 
## Type of penalty       : SIC with value, 8.76108 
## Maximum no. of cpts   : Inf 
## Changepoint Locations :
plot(m) # no evidence for a shift in mean

Not so much.

The major outlier is image 1187, the image with two boards in one lug. The boards are from two different logs (160, 153) consequently the relative positions are meaningless.

The next worst is 1626. Based on two barcodes. Manual calcs agree, as do calcs based on individual barcodes.

Board orientation w.r.t log csys. Ideally 4 peaks separated by 90 deg. Expect the cant direction (two of the peaks separated by 180 deg) to be more popular.

histogram(~theta*180/pi | as.factor(SWILogNumber), nint=100, C)

Check on board position info:

B = sqlQuery(ch, "
             select t.x, t.y, sqrt(x*x + y*y) as R, left(F.SWILogNumber,3) as SWILogNumber
             from (select flitchID, avg(boardCentroidX_mm) as x, avg(boardCentroidY_mm) as y 
                    from SICK_barcodes as B, SICK_images as I 
                      where I.id=B.imageId 
                      group by flitchID) as t
             left join TRIMMER2_FlitchDetail as F on F.flitchId=t.flitchId 
             where x is not null")
xyplot(y ~ x | as.factor(SWILogNumber), B, group=paste("R>100",(R>100)), pch=19, panel=function(x,y,...) {
  panel.abline(h=0, col="grey70")
  panel.abline(v=0, col="grey70")
  panel.xyplot(x,y,...)
}, aspect='iso', auto.key=TRUE)

All looks well.

Radial Profile

DONE: based on individual barcodes, assign centroid to each board

DONE: restrict logs to exclude poor recovery

F = sqlQuery(ch, "select left(SWILogNumber,3) as SWILogNumber, MOE, R from TRIMMER2_FlitchDetail as f, ecoustic as e where e.flitchId=f.flitchId and f.R is not null and MOE>0 and MOE<>6.5")
xyplot(MOE ~ R | as.factor(SWILogNumber), F, subset=!(F$SWILogNumber%in%marco.drop))

As poor a relationship as we saw in the LS15 data. Some logs have a strong pith to bark trend (e.g. 160) but others do not (e.g. 144). Possibly an accurate portrayal of change in MOE with distance from the pith, but also possibly a result of LE position poorly representing whole board position relative to the pith. Might also be influenced by green-ness (will check again when we have dry MoE).

DONE: classify boards as side/cant. see incant.py

S = sqlQuery(ch, "select *, i.id as imageId from sawPatternBoards as b, sawPatterns as s, SICK_images as i where s.id=b.sawPatternId and i.flitchId=b.flitchId")
#str(S)
xyplot(yc ~ xc | as.factor(SWILogNumber), S, group=parent, pch=19, panel=function(x,y,...) {
  panel.abline(h=0, col="grey70")
  panel.abline(v=0, col="grey70")
  #panel.abline(c(0,tan(cantAngle_rad)))
  panel.xyplot(x,y,...)
}, aspect='iso')#, subset=SWILogNumber==126)
#SS=S[S$SWILogNumber==126,]
#plot(yc ~ xc, SS)
#identify(SS$xc,SS$yc,SS$imageId)
ch = odbcConnect('HYNE','sa','password12')
S = sqlQuery(ch, "select b.*, e.MOE, e.Density, s.SWILogNumber
             from 
               sawPatternBoards as b, 
               sawPatterns as s, 
               SICK_images as i, 
               ecoustic as e
             where 
               s.id=b.sawPatternId 
               and i.flitchId=b.flitchId
             and e.flitchId2=b.flitchId")
S$R=sqrt(S$xc^2+S$yc^2)
#str(S)
xyplot(Density ~ R | as.factor(SWILogNumber), group=parent, S, type="p", subset=parent%in%c('cant1','cant2','cant3'))

Green density patterns look reasonable.

Plot the radial variation of MOE for just the cant boards (colour indicates cant ‘strip’):

xyplot(MOE ~ R | as.factor(SWILogNumber), group=parent, S, type="p", 
       subset=parent%in%c('cant1','cant2','cant3'), pch=19, cex=1.5,
       panel=function(...){
         panel.abline(h=6.5, col='grey70', lty=3)
         panel.xyplot(...)
       })

Where are the low MOE boards? Remember that MOE=6.5 is a default value.

S$board.class = "<6.5"
S$board.class[S$MOE==6.5] = "=6.5"
S$board.class[S$MOE>6.5] = ">6.5"
S$board.class = factor(S$board.class, levels=c('<6.5','=6.5','>6.5'), ordered=TRUE)
xyplot(yc ~ xc | as.factor(SWILogNumber), S, group=board.class, pch=19, panel=function(x,y,...) {
  panel.abline(h=0, col="grey70")
  panel.abline(v=0, col="grey70")
  #panel.abline(c(0,tan(cantAngle_rad)))
  panel.xyplot(x,y,...)
}, aspect='iso', auto.key=TRUE)

Hardly follows the “low MOE boards near the pith, high in the outerwood” paradigm. While some do look like that (e.g. 103, 145, 216), others run completely counter (e.g. 192, 214). Perhaps a consequence of using green swv to predict MOE?

DONE: plot probability of getting boards with stiffness<6.5GPa for different cant resawings

Plot the probability a cant board has an MOE of less than 6.5 GPa based on distance from the pith:

# grab log data
#L = sqlQuery(ch, "select * 
#              from logs, yardTrimmed 
#              where logs.SWILogNumber=yardTrimmed.SWILogNumber 
#              and DateAndTime>'2014-08-31'")
L$log.swv = L$SWV # use hitman velocity rather than calibre as there are fewer NA's
C = S[substr(S$parent,1,4)=='cant',]
C = merge(C,L[,c('SWILogNumber','log.swv')],by='SWILogNumber')
C$log.class = 'low.log.swv'
C$log.class[C$log.swv>3306] = 'high.log.swv'
rs = seq(50,300,by=50)
P = data.frame()
for (i in 1:length(rs)) {
  P[i,'total'] = sum(C$MOE[C$R<=rs[i]]<6.5)/sum(C$R<=rs[i])
  for (c in unique(C$log.class)) {
    P[i,c] = sum(C$MOE[C$R<=rs[i] & C$log.class==c]<6.5)/sum(C$R<=rs[i] & C$log.class==c)
    }
}
par(mfcol=c(1,1))
matplot(rs,as.matrix(P),type="l",xlab="minimum distance from pith",ylab="fraction boards with MOE<6.5",col=c('black','red','green'),lty=1)
legend('bottomleft',names(P),lty=1,col=c('black','red','green'))

Interesting. Over all cants, boxing out more of the pith can decrease the proportion on low MOE material by ~4%. Hardly a spectacular improvement, but unsurprising given where the low MOE boards are in the saw patterns.

Logs with low swv show essentially no outturn improvement with increasing pith-boxing, whereas logs with high swv are improved (e.g. by ~8% if)

DONE: side board c.f. cant MOE distributions. how many side boards have MOE<6.50?

histogram(~MOE | substr(parent,1,4), S, layout=c(1,2,1), subset=MOE>0&!(S$SWILogNumber%in%marco.drop), panel = function(...) {
  panel.histogram(...)
  panel.abline(v=6.5, col="red")
})
table(paste("MOE>6.5=",S$MOE>6.5),substr(S$parent,1,4))/nrow(S)
##                 
##                       cant      side
##   MOE>6.5= FALSE 0.2570492 0.2819672
##   MOE>6.5= TRUE  0.1796721 0.2813115

50% of side boards have MOE<6.5 c.f. 60% of cant boards.

DONE: Cant SWV from cant boards

DONE: Cant SWV vs log SWV

for (i in 1:nrow(L)) {
  ii = S$SWILogNumber==L$SWILogNumber[i] & substr(S$parent,1,4)=='cant'
  L[i,"cant.swv"] = mean(sqrt(S$MOE[ii]*1e9/S$Density[ii]), na.rm=TRUE)
}
par(mfcol=c(1,1))
plot(cant.swv ~ log.swv, L)
abline(c(0,1), col='grey70', lty=2)

Poor relationship between cant and log swv. Probably because estimating cant SWV using average SWV of boards cut from it dosn’t look too useful.

Recommendations

To make merge different board data streams easier:

Assigning log numbers to boards with lost/unreadable labels would be much easier if

If the green and dry board data is to be merged, then to avoid extra effort need to make sure that as many barcodes as possible are read from each dry board SICK image.